package learn.one;

import java.lang.reflect.Proxy;

public class Main {
    public static void main(String[] args) {
        Subject realSubject = new RealSubject();
        Subject proxySubject = (Subject) Proxy.newProxyInstance(
                realSubject.getClass().getClassLoader(),
                realSubject.getClass().getInterfaces(),
                new ProxyHandler(realSubject));

        proxySubject.doSomething();
    }
}